import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 19182
 * Date: 2025-09-19
 * Time: 22:56
 */
public class UdpDictSever extends UdpEchoSever{
    private HashMap<String, String> dict = new HashMap<>();
    public UdpDictSever(int port) throws SocketException {
        super(port);
         dict.put("hello", "你好");
         dict.put("world", "世界");
         dict.put("cat", "小猫");
         dict.put("dog", "小狗");
         dict.put("pig", "小猪");
    }
    public String process(String request){
        return dict.getOrDefault(request, "没有找到该单词");
    }

    public static void main(String[] args) throws IOException {
        UdpDictSever udpDictSever = new UdpDictSever(9090);
        udpDictSever.start();
    }

}
